package com.yc.http.d0703;

public class HttpServlet {

    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException {
        if (request.getMethod().equals("GET")) {
            doGet(request, response);
        } else if (request.getMethod().equals("POST")) {
            doPost(request, response);
        } else {
            // ...
        }
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
        throw new ServletException("405 get 方法不支持");
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
        throw new ServletException("405 post 方法不支持");
    }

    //...
}
